package cz.cvut.fel.gfupan.gui.execution;

import java.math.BigInteger;
import javax.swing.text.JTextComponent;

public class Mire implements Executable {

    private JTextComponent mire;
    private Executable avg;

    public Mire(JTextComponent mire, Executable avg) {
        this.mire = mire;
        this.avg = avg;
    }

    @Override
    public String execute() {
        try {
            BigInteger f1big = new BigInteger(mire.getText());
            BigInteger f2big = new BigInteger(avg.execute());
            return f1big.subtract(f2big).toString();
        } catch (NumberFormatException e) {
        }
        return "";
    }
}